#include <bits/stdc++.h>
using namespace std;

class Solution{
public:
	vector<int> sortedSquares(vector<int>& A) {
		vector<int> result(A.size(),0);
		int k = A.size() - 1;
		int l = 0;
		int r = A.size() - 1;
		while(l<=r){
			if(A[l] * A[l] > A[r] * A[r]){
				result[k--] = A[l] * A[l];
				l++;
			}else{
				result[k--] = A[r] * A[r];
				r--;
			}
		}
		return result;
	}
};


int main(){
	
	
	return 0;
}
